<%--
  Created by IntelliJ IDEA.
  User: 1
  Date: 2022/1/10
  Time: 9:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
</head>
<body>
<div class="container" id="div1">
    <caption>
        <div style="float: right;margin-bottom: 5px">
        </div>
    </caption>
    <table id="table" class="table table-hover">

    </table>
</div>

<%--<div class="modal fade" id="myModal">
    <div class="modal-dialog">
        <div class="modal-content">

            <!-- 模态框头部 -->
            <div class="modal-header">
                <h4 class="modal-title">模态框头部</h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- 模态框主体 -->
            <div class="modal-body">
                <form id="add">
                产品编号: <input type="text" name="productId" readonly="readonly" id="productId"> <br>
                库存报警下限数: <input type="text" name="minAmount"> <br>
                库存报警上限数: <input type="text" name="maxAmount"> <br>
                最大存储量: <input type="text" name="maxCapacityAmount"> <br>
                当前存储量: <input type="text" name="amount"> <br>
                登记人: <input type="text" name="register"> <br>
                </form>
                <button onclick="add()">添加</button>
            </div>

            <!-- 模态框底部 -->
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
            </div>

        </div>
    </div>
</div>--%>


<DIV class=DIV_STYLE2 style="display: none" id="div2"><TABLE cellSpacing=0 cellPadding=0 width=1000 align=center bgColor=#ffffff border=0 >
    <div style="position: relative;left: 60%">

        <INPUT   onclick="add()" type=button value=添加工序>
        <INPUT onmouseup="this.className='btn3_mouseup'" onclick=fanhui() onmouseover="this.className='btn3_mouseover'" onmousedown="this.className='btn3_mousedown'" onmouseout="this.className='btn3_mouseout'" class=btn3_mouseout type=button value=返回>
    </div>
    <TBODY>
    <TR>
        <TD class=TABLE_STYLE6 vAlign=bottom rowSpan=2 align=center>
            <TABLE style="BORDER-TOP: #333333 1px solid; BORDER-RIGHT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid; BORDER-LEFT: #333333 1px solid" cellSpacing=0 cellPadding=0 width="100%" border=0>
                <TBODY>
                <TR>
                    <TD height=10 colSpan=4>
                        <TABLE width="100%">
                            <TBODY>
                            <TR>
                                <form id="add">
                                <TD>
                                    <table align="center">
                                        <tr>
                                            <td><h3>库存订单</h3></td>
                                        </tr>
                                    </table>
                                    <br>
                                    <div>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>产品名称:</span>
                                        <span>dsdssads</span>
                                        <span style="position: relative;left:500px;">产品编号:<span><input type="text" readonly="readonly" id="productId"> </span></span>
                                        <br>
                                        <br>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>库存报警下限数:<input id="minAmount" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 30%;outline:none"></span>
                                        <span>库存报警上限数:<input id="maxAmount" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 30%;outline:none"></span>
                                        <br>
                                        <br>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>最大存储量:<input id="maxCapacityAmount" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 30%;outline:none"></span>
                                        <span>当前存储量:<input id="amount" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 30%;outline:none"></span>
                                    </div>
                                    <br>
                                    <br>
                                    <div>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>登记人:<input id="register" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none"></span>
                                        &nbsp;&nbsp;&nbsp;&nbsp;
                                        <span style="position: relative;left:200px;">登记时间:<span>2022-01-07 08:46:34</span></span>
                                    </div>
                                    <br>
                                    <div>
                                        <div>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <span style="position: relative;top: -40px">设计要求:</span><textarea style="resize: none" rows=4 cols="100" ></textarea>
                                        </div>
                                    </div>
                                </TD>
                                </form></TR></TBODY></TABLE></TD></TR>
                <TR>
                    <TD width=56 colSpan=3 noWrap></TD></TR>
                <TR>
                    <TD height=100 colSpan=3 noWrap></TD>
                    <TD></TD></TR>
                <TR vAlign=bottom>
                    <TD colSpan=4 noWrap align=center></TD></TR></TD>
                <TR>
                    <TD colSpan=4 noWrap align=right></TD></TR></TBODY></TABLE></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD></TR>
    <TR>
        <TD bgColor=#333333 height=120 width=1></TD>
        <TD bgColor=#666666 height=120 width=1></TD>
        <TD bgColor=#999999 height=120 width=1></TD></TR>
    <TR align=right vAlign=top>
        <TD colSpan=4>
            <TABLE class=TABLE_STYLE6 cellSpacing=0 cellPadding=0 align=center border=0>
                <TBODY>
                <TR>
                    <TD bgColor=#333333 height=1></TD></TR>
                <TR>
                    <TD bgColor=#666666 height=1></TD></TR>
                <TR>
                    <TD bgColor=#999999 height=1></TD></TR></TBODY></TABLE></TD></TR>
    <TR align=right vAlign=middle>
        <TD colSpan=4></TD></TR></TBODY></TABLE></DIV>
<script src="../js/jquery-form.js"></script>
<script src="../js/jquery.serializejson.js"></script>
<script>
    $(function () {
        $("#table").bootstrapTable({
            method:"get",
            contentType:"application/json",
            url:"http://localhost:8080/ck/select",
            striped:true,
            pageNumber:1,
            pagination:true,
            sidePagination:"server",
            pageSize:5,
            pageList:[3,5,7,10],
            queryParams:function (param) {
                return {
                    page: (param.offset / param.limit) + 1,
                    pageNum: param.limit,
                }
            },
            columns:[
                {title:"产品编号",field:"productId",align:"center"},
                {title:"产品名称",field:"productName",align:"center"},
                {title:"产地",field:"factoryName",align:"center"},
                {title:"操作",field:"id",align:"center",formatter:function (value,row) {
                        var btn1="<button class='btn btn-primary btn-sm' data-toggle='modal' data-target='#myModal' onclick=update('"+row.productId+"')>添加</button>";
                        return btn1
                    }}
            ]
        })
    })
    function update(sd) {
        $("#productId").val(sd)
        document.getElementById("div1").style.display='none'
        document.getElementById("div2").style.display='block'
    }
    
    function add() {
        let productId = $("#productId").val();
        let minAmount = $("#minAmount").val();
        let maxAmount = $("#maxAmount").val();
        let maxCapacityAmount = $("#maxCapacityAmount").val();
        let amount = $("#amount").val();
        let register = $("#register").val();
        let s = JSON.stringify(jQuery);
        $.getJSON("http://localhost:8080/ck/add",{productId:productId,minAmount:minAmount,maxAmount:maxAmount,maxCapacityAmount:maxCapacityAmount,amount:amount,register:register},function (data) {
            if(data==1){
                window.location="/wp/addcell.jsp";
            }
        })
    }
    function fanhui() {
        window.location="/wp/addcell.jsp";
    }
</script>
</body>
</html>
